#!/bin/bash

# modify these two variables to be the width and height of your desired variants
thumbbox=315
thumbwidth=315
thumbheight=186

coverbox=1008
coverwidth=1008
coverheight=434

featuredbox=474
featuredwidth=474
featuredheight=250

clear

echo Resizing your images and making featured, covers, and thumbnails

rm *-thumb.jpg *-cover.jpg *-featured.jpg

for img in `ls *.jpg`
do
    name=${img%.*}
    ext=${img#*.}
    convert -adaptive-resize ${thumbwidth}x${thumbheight}^ -gravity center -crop ${thumbwidth}x${thumbheight}+0+0 $img $name-thumb.$ext
    convert -adaptive-resize ${coverbox} -gravity center -crop ${coverwidth}x${coverheight}+0+0 $img $name-cover.$ext
    convert -adaptive-resize ${featuredwidth}x${featuredheight}^ -gravity center -crop ${featuredwidth}x${featuredheight}+0+0 $img $name-featured.$ext
done
